import * as THREE from 'three';

const BAS = {
    ShaderChunk: {
        // 保留原有shader代码...
    }
};

// 实现PrefabBufferGeometry（需适配新版Three.js）
BAS.PrefabBufferGeometry = class extends THREE.BufferGeometry {
    constructor(prefab, count) {
        super();
        // 使用BufferAttribute实现新版API
        this.setAttribute('position',
            new THREE.BufferAttribute(prefab.attributes.position.array, 3));
    }
};

// 实现BaseAnimationMaterial
BAS.BaseAnimationMaterial = class BASPhongAnimationMaterial extends THREE.ShaderMaterial {
    // 静态方法：不依赖this
    static _buildVertexShader(params) {
        return /* GLSL代码生成逻辑 */;
    }

    static _buildFragmentShader(params) {
        return /* GLSL代码生成逻辑 */;
    }

    constructor(params) {
        // ✅ 静态方法直接通过类名调用
        const vertexShader = BASPhongAnimationMaterial._buildVertexShader(params);
        const fragmentShader = BASPhongAnimationMaterial._buildFragmentShader(params);

        // ✅ 安全传递参数给super()
        super({ ...params, vertexShader, fragmentShader });
    }
};

export default BAS;